"use strict";

let gulp = require('gulp');
let clean = require('gulp-clean');

const dist = 'assets';

gulp.task('default', function(){

    gulp.run(['clean-build','watch-scripts','watch-css']);

});


gulp.task('clean-build', function() {

    gulp.src([dist], {read: false})
        .pipe(clean({force: true}));

    gulp.src(['src/assets/**/*.js'])
        .pipe(gulp.dest(dist));

    gulp.src(['src/assets/**/*.css'])
        .pipe(gulp.dest(dist));

});

gulp.task('watch-scripts', function() {

    gulp.watch(['src/assets/**/*.js'], function(){
        gulp.src(['src/assets/**/*.js'])
            .pipe(gulp.dest(dist))
    });

});

gulp.task('watch-css', function() {

    gulp.watch(['src/assets/**/*.css'], function() {
        gulp.src(['src/assets/**/*.css'])
            .pipe(gulp.dest(dist))
    });

});
